package Gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JSpinner;
import javax.swing.JButton;
import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.BoxLayout;

import Database.XMLProvider;

public class mainFrame extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					XMLProvider.LoadXML();
					mainFrame frame = new mainFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public mainFrame() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton btnUpdate = new JButton("Update Wanted");
		btnUpdate.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				UpdateDialog updateDialog  = new UpdateDialog();
				updateDialog.setVisible(true);
			}
		});
		btnUpdate.setBounds(149, 11, 129, 79);
		contentPane.add(btnUpdate);
		
		JButton btnCreate = new JButton("Create new Wanted");
		btnCreate.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				CreateDialog createDialog = new CreateDialog();
				createDialog.setVisible(true);
			}
		});
		btnCreate.setBounds(10, 11, 129, 79);
		contentPane.add(btnCreate);
		
		JButton btnDelete = new JButton("Delete Wanted");
		btnDelete.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				DeleleDialog deleteDialog = new DeleleDialog();
				deleteDialog.setVisible(true);
			}
		});
		btnDelete.setBounds(295, 11, 129, 79);
		contentPane.add(btnDelete);
		
		JButton btnSearch = new JButton("Search");
		btnSearch.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				SearchDialog searchDialog = new SearchDialog();
				searchDialog.setVisible(true);
			}
		});
		btnSearch.setBounds(10, 101, 129, 79);
		contentPane.add(btnSearch);
		
		JButton btnDisplay = new JButton("Display");
		btnDisplay.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				DisplayDialog displayDialog = new DisplayDialog();
				displayDialog.setVisible(true);
			}
		});
		btnDisplay.setBounds(149, 101, 129, 79);
		contentPane.add(btnDisplay);		
	}
}
